/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hhf.worldzones.services.locationServices.continentServices;

import hhf.worldzones.daos.ContinentDAO;
import hhf.worldzones.entities.Continent;
import hhf.worldzones.exceptions.ContinentUnknownException;
import hhf.worldzones.exceptions.EntityUnknownException;
import hhf.worldzones.services.locationServices.countryServices.CountryFacadeLocal;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.slf4j.Logger;

/**
 *
 * @author HHFrancois
 */
@Stateless
public class ContinentFacade implements ContinentFacadeLocal {

    @Inject
    Logger logger;
    @EJB
    ContinentDAO continentDAO;
    @EJB
    CountryFacadeLocal countryFacadeLocal;

    @Override
    public void remove(Continent entity) {
        logger.debug("remove Continent : " + entity.getLabel());
        //continentDAO.remove(entity);
    }

    @Override
    public void persist(Continent entity) {
        System.out.println("dsdkslmdkfsdlmfksdfsdf");
        logger.info("persistContinent : " + entity.getLabel());
        //continentDAO.persist(entity);
    }

    @Override
    public Continent merge(Continent entity) {
        return continentDAO.merge(entity);
    }

    @Override
    public List<Continent> findRange(int[] range) {
        return continentDAO.findRange(range);
    }

	 @Override
	 public 	List<Continent> findAllWithoutOffline() {
		 return continentDAO.findAll();
	 }
	 
    @Override
    public List<Continent> findAll() {
        return continentDAO.findAll();
    }

    @Override
    public int count() {
        return continentDAO.count();
    }

    @Override
    public Continent find(String id) throws ContinentUnknownException {
        logger.info("FIND CONTINENT : " + id);
        Continent c = null;
        try {
            c = continentDAO.find(id);
        } catch (EntityUnknownException ex) {
            throw new ContinentUnknownException(ex);
        }
        c.getCountries().size();
        return c;
    }

    @Override
    public Continent testTest(List<Continent> listTest) {
        return null;
    }
}
